package com.util;

import java.security.MessageDigest;
import java.util.Arrays;

public class HashTest {
    public static void MD5(){
        try{
            MessageDigest instance = MessageDigest.getInstance("MD5");
            instance.update("ahjvdoa".getBytes());

            byte[] digest = instance.digest();
            String string = Arrays.toString(digest);
            System.out.println(string);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void SHA256(){
        try{
            MessageDigest instance = MessageDigest.getInstance("SHA-256");
            instance.update("ahjvdoa".getBytes());

            byte[] digest = instance.digest();
            String string = Arrays.toString(digest);
            System.out.println(string);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void SHA512(){
        try{
            MessageDigest instance = MessageDigest.getInstance("SHA-512");
            instance.update("ahjvdoa".getBytes());

            byte[] digest = instance.digest();
            String string = Arrays.toString(digest);
            System.out.println(string);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        HashTest.MD5();
        HashTest.SHA256();
        HashTest.SHA512();
    }
}
